package com.yz.api.facade.promotion;

import com.yz.model.vo.promotion.PromotionVo;
import com.yz.common.resp.BaseResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created With IntelliJ IDEA.
 * Descriptions:优惠码
 * User:Mr.Du
 * Date:2024/3/23
 * Time:16:56
 */
@Tag(name = "优惠码接口")
public interface PromotionFacade {

    @Operation(summary = "生成优惠码")
    @Parameters(value = {@Parameter(name = "uid", description = "用户id", in = ParameterIn.HEADER)})
    @PostMapping("/promotion/gen")
    BaseResponse createPromotionCode(@RequestHeader Long uid);

    @Operation(summary = "校验优惠码")
    @Parameters(value = {@Parameter(name = "uid", description = "用户id", in = ParameterIn.HEADER),
            @Parameter(name = "codes", description = "优惠码", in = ParameterIn.QUERY)}
    )
    @GetMapping("/promotion/check")
    BaseResponse<PromotionVo> checkPromotionCode(@RequestHeader Long uid, @RequestParam String codes);

    @Operation(summary = "获取优惠码")
    @Parameters(value = {@Parameter(name = "uid", description = "用户id", in = ParameterIn.HEADER),
            @Parameter(name = "status", description = "使用状态", in = ParameterIn.QUERY),
            @Parameter(name = "type", description = "类型", in = ParameterIn.QUERY)
    })
    @GetMapping("/promotion")
    BaseResponse<List<PromotionVo>> getPromotionCode(@RequestHeader Long uid, @RequestParam(required = false) Integer status, @RequestParam(required = false) Integer type);

    @Operation(summary = "使用优惠码")
    @Parameters(value = {@Parameter(name = "uid", description = "用户id", in = ParameterIn.HEADER),
            @Parameter(name = "codes", description = "优惠码", in = ParameterIn.QUERY)}
    )
    @PostMapping("/promotion/use")
    BaseResponse<Boolean> usePromotionCode(@RequestHeader Long uid, @RequestParam String codes);

}
